//
//  LevelScene.h
//  BayMaxPuzzle
//
//  Created by Jacky on 15/3/28.
//
//

#ifndef __BayMaxPuzzle__LevelScene__
#define __BayMaxPuzzle__LevelScene__

#include "cocos2d.h"
#include "ui/CocosGUI.h"
#include "Global.h"

struct LevelData{
    int rows;
    int cols;
};

class LevelScene : public cocos2d::Layer
{
public:
    // there's no 'id' in cpp, so we recommend returning the class instance pointer
    static cocos2d::Scene* createScene();
    
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();
    
    // implement the "static create()" method manually
    CREATE_FUNC(LevelScene);
    
private:
    
    void initPageview();
    void initBalls();
    void pageViewEvent(Ref *pSender, cocos2d::ui::PageView::EventType type);
    
    cocos2d::ui::PageView* _pageView;
    int _pageCount;
    
    cocos2d::Sprite* _indexBall[CHAPTER+1];
    cocos2d::Sprite* _curIndexBall;
    
    LevelData _leveldatas[CHAPTER][SECTION];
    
    void initLevelDatas();
    void gotoLevel(int chapter, int section);
    std::string convertTimeFromIntToStr(int time);
    float getHeightScale();
    float getRealScale(int picWidth);
};
#endif /* defined(__BayMaxPuzzle__LevelScene__) */
